package chai.ning.train_9;

public class Triangle extends Shape {
	
	protected double firstEdge ;
	protected double secondEdge ;
	protected double thirdEdge ;
	
	public Triangle(){
	    // 可以在这里完成对 type 的初始化
		this.type = "三角形" ;
	}
	
	public void calculate() {
	    // 在这里计算三角形的面积，并将面积存储到 area 变量中 ( area 是从父类继承的、可见的实例变量 )
		double x = (firstEdge+secondEdge+thirdEdge)*(firstEdge+secondEdge-thirdEdge)*(firstEdge+thirdEdge-secondEdge)*(secondEdge+thirdEdge-firstEdge)	;
		double y = Math.sqrt(x);
		this.area = y/4;		
	}
	
	public void description() {
	    // 在这里输出三角形基本信息(比如三边的长度)
	    // 最后通过调用从父类继承的、可见的 show 方法输出 三角形的面积
		System.out.println( "三边长度："+ this.firstEdge + "," + this.secondEdge + "," + this.thirdEdge );
		show();
	}

}
